/* 全局样式 */
:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --dark-color: #202124;
    --light-color: #f8f9fa;
    --border-color: #dadce0;
    --text-color: #202124;
    --text-secondary: #5f6368;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-color);
    background-color: #f5f5f5;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.mode-selector {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.mode-label {
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.btn-mode {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    transition: all 0.3s ease;
}

.btn-mode:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 主容器样式 */
.main-container {
    flex: 1;
    padding: 20px 0;
    max-width: 1000px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.chat-box {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* 消息样式 */
.user-message, .ai-message, .system-message {
    display: flex;
    margin-bottom: 20px;
    position: relative;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .message-content {
    background-color: #f0f2f5;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.system-message {
    justify-content: center;
}

.system-message .message-content {
    background-color: rgba(255, 193, 7, 0.2);
    color: #856404;
    border-radius: 8px;
    text-align: center;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 5px;
    opacity: 0.7;
}

.user-message .message-time {
    text-align: right;
}

/* 消息操作 */
.message-actions {
    position: absolute;
    top: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.user-message .message-actions {
    left: -30px;
}

.ai-message .message-actions {
    right: -30px;
}

.message-actions button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
}

.message-actions button:hover {
    color: var(--primary-color);
}

.user-message:hover .message-actions,
.ai-message:hover .message-actions {
    opacity: 1;
}

/* 输入区域样式 */
.chat-input-container {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

#messageInput {
    resize: none;
    overflow: auto;
    transition: height 0.2s ease;
    border-radius: 20px;
    padding: 10px 15px;
    max-height: 120px;
}

.btn-send {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-clear {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 加载动画 */
.chat-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 代码块样式 */
pre {
    background-color: #282c34;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
    overflow-x: auto;
    position: relative;
}

pre:hover .copy-code {
    opacity: 1;
}

.copy-code {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.copy-code:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

code {
    font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', monospace;
    font-size: 0.9em;
}

/* 页脚样式 */
.footer {
    background-color: white;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.2rem;
    }
    
    .mode-label {
        display: none;
    }
    
    .main-container {
        padding: 10px;
    }
    
    .chat-container {
        height: calc(100vh - 150px);
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .btn-send span {
        display: none;
    }
}

/* 暗黑模式 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e8eaed;
        --text-secondary: #9aa0a6;
        --dark-color: #202124;
        --light-color: #303134;
        --border-color: #3c4043;
    }
    
    body {
        background-color: #202124;
    }
    
    .chat-container,
    .chat-input-container,
    .footer {
        background-color: #303134;
    }
    
    #messageInput {
        background-color: #3c4043;
        color: var(--text-color);
        border-color: transparent;
    }
    
    .ai-message .message-content {
        background-color: #3c4043;
    }
    
    .system-message .message-content {
        background-color: rgba(255, 193, 7, 0.1);
    }
} 